 package org.edu.modules.portal.controller;

 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.github.xiaoymin.knife4j.annotations.ApiSort;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import java.util.Arrays;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import org.edu.common.api.vo.Result;
 import org.edu.common.aspect.annotation.AutoLog;
 import org.edu.common.system.base.controller.BaseController;
 import org.edu.common.system.query.QueryGenerator;
 import org.edu.modules.portal.entity.VeSiteLower;
 import org.edu.modules.portal.service.IVeSiteLowerService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;
















 @Api(tags = {"导航下属模块"})
 @RestController
 @RequestMapping({"/portal/veSiteLower"})
 @ApiSort(40)
 public class VeSiteLowerController
   extends BaseController<VeSiteLower, IVeSiteLowerService>
 {
/*  52 */   private static final Logger log = LoggerFactory.getLogger(org.edu.modules.portal.controller.VeSiteLowerController.class);







   @Autowired
   private IVeSiteLowerService veSiteLowerService;







   @AutoLog("导航下属模块-模块列表查询")
   @ApiOperation(value = "模块列表查询", notes = "导航下属模块-模块列表查询")
   @PostMapping({"/list"})
   @ApiOperationSupport(order = 1)
   @ApiImplicitParams({@ApiImplicitParam(name = "siteid", value = "网站id", required = true), @ApiImplicitParam(name = "navid", value = "导航id", required = true), @ApiImplicitParam(name = "base", value = "基础页面top、bottom、default、side等", required = true)})
   public Result<?> queryList(@ApiIgnore VeSiteLower veSiteLower, HttpServletRequest req) {
     QueryWrapper<VeSiteLower> queryWrapper = QueryGenerator.initQueryWrapper(veSiteLower, req.getParameterMap());
     List<VeSiteLower> list = this.veSiteLowerService.list((Wrapper)queryWrapper);
     return Result.OK(list);
   }






   @AutoLog("导航下属模块-通过id查询")
   @ApiOperation(value = "通过id查询", notes = "导航下属模块-通过id查询")
   @PostMapping({"/queryById"})
   @ApiOperationSupport(order = 2)
   public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
/*  90 */     VeSiteLower veSiteLower = (VeSiteLower)this.veSiteLowerService.getById(id);
     if (veSiteLower == null) {
       return Result.error("未找到对应数据");
     }
/*  94 */     return Result.OK(veSiteLower);
   }






   @AutoLog("导航下属模块-新增信息")
   @ApiOperation(value = "批量新增信息", notes = "导航下属模块-新增信息")
   @PostMapping({"/addBatch"})
   @ApiOperationSupport(order = 3)
   public Result<?> add(@RequestBody List<VeSiteLower> veSiteLowers) {
     if (this.veSiteLowerService.saveList(veSiteLowers) > 0) {
       return Result.OK("添加成功！");
     }
    return Result.error("操作失败");
   }






   @AutoLog("导航下属模块-批量修改信息")
   @ApiOperation(value = "批量修改信息", notes = "导航下属模块-批量修改信息")
   @PostMapping({"/editBatch"})
   @ApiOperationSupport(order = 4)
   public Result<?> edit(@RequestBody List<VeSiteLower> veSiteLowers) {
/* 123 */     if (this.veSiteLowerService.updateList(veSiteLowers) > 0) {
/* 124 */       return Result.OK("编辑成功!");
     }
     return Result.error("操作失败");
   }






   @AutoLog("导航下属模块-通过id删除")
   @ApiOperation(value = "通过id删除", notes = "导航下属模块-通过id删除")
   @PostMapping({"/delete"})
   @ApiOperationSupport(order = 6)
   public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
     if (this.veSiteLowerService.removeById(id)) {
       return Result.OK("删除成功!");
     }
     return Result.error("操作失败");
   }






   @AutoLog("导航下属模块-批量删除")
   @ApiOperation(value = "批量删除", notes = "导航下属模块-批量删除")
   @PostMapping({"/deleteBatch"})
   @ApiOperationSupport(order = 5)
   public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
     if (this.veSiteLowerService.removeByIds(Arrays.asList(ids.split(",")))) {
/* 156 */       return Result.OK("批量删除成功!");
     }
     return Result.error("操作失败");
   }
 }



